﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>摄像头测试工具</title>
    <script type="text/javascript" src="../ocx/Camera.js"></script>
</head>
<div>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="打开设备"
           onclick="openDeviceByCamera()"/>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="获取设备信息"
           onclick="getStatusByCamera()"/>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="启动预览"
           onclick="startPreviewByCamera()"/>

    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="拍照"
           onclick="takePhotoByCamera()"/>

    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="停止调用"
           onclick="stopPreviewByCamera()"/>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="关闭设备"
           onclick="closeDeviceByCamera()"/>
</div>
<div>
    <input id="result"
           type="text"
           style="width:90%;height:50px;
           margin-top:30px;
           margin-right:50px"
           readonly="readonly"/>
</div>
<object
               id="CameraId"
               classid="CLSID:A9AC8A94-A39F-4910-911A-2AB5D5D9CDE9"
               name="CameraJs">
     
</object>

<script>
    function openDeviceByCamera() {
        var ret = openDevice()
        document.getElementById("result").value = ret;
    }

    function getStatusByCamera() {
        var ret = getStatus()
        document.getElementById("result").value = ret;
    }

    function startPreviewByCamera() {
        var ret = startPreview()
        document.getElementById("result").value = ret;
    }

    function takePhotoByCamera() {
        var ret = takePicture()
        document.getElementById("result").value = ret;
    }

    function stopPreviewByCamera() {
        var ret = stopPreview()
        document.getElementById("result").value = ret;
    }

    function closeDeviceByCamera() {
        var ret = closeDevice()
        document.getElementById("result").value = ret;
    }
</script>
</html>